<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // var arr =  [{name:"张三",age:20},{name:"李四",age:23},{name:"王五",age:19}];
      var arr = [
        { name: "张三", age: 20 },
        { name: "李四", age: 23 },
        { name: "王五", age: 19 },
      ];

      arr.forEach(function (item) {
        console.log(item);
        console.log("姓名是" + item.name, "年龄是" + item.age);
      });

      var res = arr.map(function (item) {
        return item.age;
      });
      console.log(res);
      var res = arr.filter(function (item) {
        return item.age >= 20;
      });
      console.log(res);
    </script>
  </body>
</html>
